-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add v2v case about virt-v2v-in-place #5896
Add v2v case about virt-v2v-in-place #5896
Conversation
@xiaodwan pls review, thanks avocado run --vt-type v2v convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.noneJOB ID : 83a66850d3a34143723ccf90881266ed3dab9826 |
v2v/tests/src/convert_from_file.py
Outdated
elif checkpoint == 'virt_v2v_in_place': | ||
v2v_params.update({'new_name': ''}) | ||
v2v_result = utils_v2v.cmd_run(str(utils_v2v.v2v_cmd(v2v_params, cmd_only=True)). | ||
replace('/usr/bin/virt-v2v', '/usr/libexec/virt-v2v-in-place'). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think process.run can be used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to use check log function of v2v_result to check expect_msg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2v.cmd_run also calls process.run. You can check the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand, I need to use log_check = utils_v2v.check_log(params, output) of functiion check_result(result, status_error to check msg_content = 'virt-v2v-in-place: warning:...“
If I used process.run to run virt-v2v-in-place command, I need to write another code to check msg_content, which is unnecessary things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convert the result process.run to string and save it to 'output', you can then use utils_v2v.check_log(params, output) to do the check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything wrong with the method I am using now? Why is it better to use process.run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is not tidy. For the maintainers, it's hard to understand.
3d87a04
to
390390c
Compare
@xiaodwan updated codes according your suggestions, pls review, thanks! avocado run --vt-type v2v convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.noneJOB ID : fda97c2c8044fdc7040bac9e80a01f796d5d924c |
Correct test result of last comment: avocado run --vt-type v2v convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.noneJOB ID : a4f6c6af809abaf58b7c17f9d98e3b47634dc0bb |
v2v/tests/src/convert_from_file.py
Outdated
@@ -288,6 +288,12 @@ def vm_check(): | |||
log_fail('fail to download guest image from libvirt-ci resource') | |||
image_name = re.search(r'RHEL-\S*\w*.qcow2', params.get('image_url')).group() | |||
v2v_params.update({'input_file': os.path.join(tmp_path, image_name)}) | |||
if checkpoint == 'virt_v2v_in_place': | |||
output = utils_v2v.cmd_run('/usr/libexec/virt-v2v-in-place -i disk %s/%s' % (tmp_path, image_name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the real disk path needed here? Can we use a fake disk path? I think this is a negative scenario, it will report the error no matter what the disk path is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What 'v2v_dirty_resources' should be cleaned? If no, process.run is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not a negative scenario, virt-v2v-in-place must convert a guest from a real disk and the expected virt-v2v-in-place warning only shows in a successful conversion!
v2v/tests/src/convert_from_file.py
Outdated
@@ -331,8 +337,10 @@ def vm_check(): | |||
|
|||
if 'new_name' in v2v_params: | |||
vm_name = params['main_vm'] = v2v_params['new_name'] | |||
|
|||
check_result(v2v_result, status_error) | |||
if checkpoint == 'virt_v2v_in_place': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if checkpoint != 'xxx':
check_result(v2v_result, status_error)
Signed-off-by: Ming Xie <[email protected]>
390390c
to
960f6c0
Compare
No description provided.